<?php
defined('IN_XLP') or exit('Access Denied');
$Document = array(
    'pageid'   => 'fund-edit', //页面标示
    'pagename' => '编辑众筹目标', //当前页面名称
    'mycss'    => array(), //加载的css样式表
    'myjs'     => array(), //加载的js脚本
    'footerjs' => array(),
    'head'     => true, //加载头部文件
);

include getTpl('header', 'public');
?>
<style>
label{cursor:pointer;font-weight:normal}
.pt7{padding-top:7px;}
</style>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->
<section id="content">
    <section class="main padder">
        <div class="clearfix">
            <h4><i class="fa fa-edit"></i>编辑众筹目标</h4>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <section class="panel">
                    <div class="panel-body">
                        <form class="form-horizontal" id="fundEditForm" method="post" autocomplete="off">
                            
                            <div class="form-group">
                                <label class="col-sm-1 control-label">小&emsp;&emsp;区</label>
                                <div class="col-sm-2 pt7">
                                <?php echo $fund_info['village'] ?>
                                </div>
                            </div>                            

                            <div class="form-group">
                                <label class="col-sm-1 control-label">目标金额</label>
                                <div class="col-sm-2">
                                    <input type="hidden" name="vid" value="<?php echo $fund_info['village_id'] ?>">
                                    <input type="text" name="fund_target" id="fund_target" placeholder="众筹目标金额" value="<?php echo $fund_info['fund_target'] ?>" class="form-control" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label">众筹内容</label>
                                <div class="col-sm-2">
                                    <input name="fund_content" id="fund_content" value="<?php echo $fund_info['fund_content'] ?>" class="form-control" placeholder="最好10个字之内">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-1 control-label">是否通过审核</label>
                                <div class="col-sm-2 pt7">
                                    <input id="is_pass" type="radio" name="passed" value="0" <?php if($fund_info['passed']==0) echo 'checked'; ?> />
                                    <label for="is_pass">未通过</label>&emsp;&emsp;
                                    <input id="not_pass" type="radio" name="passed" value="1" <?php if($fund_info['passed']==1) echo 'checked'; ?> />
                                    <label for="not_pass">通过</label>
                                </div>
                            </div>

                            <div class="form-group pt7">
                                <div class="col-sm-9 col-lg-offset-1">
                                    <div class="col-sm-1">
                                        <button type="submit" id="sub-ok" data-loading-text="正在提交..." class="btn btn-primary">保存</button>
                                    </div>
                                    <button type="button" class="btn btn-white">取消</button>
                                </div>
                            </div>

                        </form>
                    </div>
                </section>
            </div>
        </div>
    </section>
</section>
<!--/ content --> 
<!--主体 结束-->
<script>
$(function(){

    $('#fundEditForm').submit(function(){
        if( $.trim($('#fund_content').val()) == '' ) {
            Msg.error('请输入众筹内容');
            resetSubmit("#sub-ok",'提交');
            return false;
        }
        if( $.trim($('#fund_target').val()) == '' ) {
            Msg.error('请输入目标金额');
            resetSubmit("#sub-ok",'提交');
            return false;
        }

        Msg.loading();
        $.post('<?php echo U("fund/edit"); ?>', $(this).serialize(), function(result){
            Msg.hide();
            resetSubmit("#sub-ok",'提交');
            if(result.status == 1) {
                Msg.ok(result.info);
            } else {
                Msg.error(result.info);
            }
        }, 'JSON');
        return false;
    });
});
</script>
<?php include getTpl('footer', 'public'); ?>